package com.centit.exchange.dao;

import java.util.HashMap;
import java.util.Map;
import com.centit.framework.core.dao.CodeBook;
import com.centit.framework.jdbc.dao.BaseDaoImpl;
import com.centit.framework.jdbc.dao.DatabaseOptUtils;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.alibaba.fastjson.JSONObject;
import com.centit.airplanebaseinfo.po.AirplaneBaseinfo;
import com.centit.exchange.po.ExchangeRate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;



/**
 * ExchangeRateDao  Repository.
 * create by scaffold 2020-04-08 
 * @author codefan@sina.com
 * T_EXCHANGE_RATE汇率表   
*/

@Repository
public class ExchangeRateDao extends BaseDaoImpl<ExchangeRate,java.lang.String>
	{

	public static final Log log = LogFactory.getLog(ExchangeRateDao.class);
	
	@Override
	public Map<String, String> getFilterField() {
		if( filterField == null){
			filterField = new HashMap<String, String>();

			filterField.put("fbDate" , CodeBook.EQUAL_HQL_ID);


			filterField.put("foreignBuyPri" , CodeBook.EQUAL_HQL_ID);

			filterField.put("moneyBuyPri" , CodeBook.EQUAL_HQL_ID);

			filterField.put("foreignSellPri" , CodeBook.EQUAL_HQL_ID);

			filterField.put("moneySellPri" , CodeBook.EQUAL_HQL_ID);

			filterField.put("bankConversionPri" , CodeBook.EQUAL_HQL_ID);

		}
		return filterField;
	} 
	
	/**
	 * @param ccxlh
	 * @return 
	 * 功能描述：获取可选时间
	 * @author 张帅
	 * @date:  2020年4月29日 下午5:18:20
	 */
	public JSONObject getUseDate(String date) {
		String sql = "SELECT wm_concat(FB_DATE) usedate FROM T_EXCHANGE_RATE  WHERE FB_DATE LIKE '%"+date+"%'";
		JSONObject obj = DatabaseOptUtils.getObjectBySqlAsJson(this, sql);
		return obj;
	}
}
